#sing SetLocal EnableDelayedExpansion
#newl set extractedImage=#path#name-imageex-|
#newl IF /I #exte==.tif (
#newl "#ppthapps\convert\convert.exe"  |-extract images app-
"#item" |--input-
"%extractedImage%%%03d.tif" |--output-
#newl ) ELSE (
#newl "#ppthapps\+\gs\bin\gswin32c.exe" |--convert pdf to tiff--
-r2400 |-r300 |--resolution. Higher resolution is used with downscalling.--
#remark PDF pages to process. Default setting is to process all pages|-dFirstPage=1 -dLastPage=3 |--Choose first and last page.--
-dTextAlphaBits=4 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dDownScaleFactor=8 -sDEVICE=tiffscaled8  -o "%extractedImage%%%03d.tif"   "#item" |--more settings--
#newl )
#newl echo( >"#path-1st.txt"|
#newl FOR %%a in ("%extractedImage%*.*") do (
#newl "#ppthapps\cuneiform-clvb\cuneiform-clvb.exe" |-program file-
-LoadImage="%%a" |-input-
-FileFormat=TxtAnsi    -RecognizeToFileName="%%a.txt" |
#remark enable spellcheck, default on|-EnableSpeller=false |
-Language=Croatian |-Language=Serbian |-Language=English |-Language=Russian |
-RecognizePictures=false |-RecognizePictures=true |--remark recognize pictures, on by default--
-DetectBold=false |-DetectBold=true |-detect bold, default on(true)-
-DetectItalic=false |-DetectItalic=true |-detect italic, default on(true)-
-DetectSize=false |-DetectSize=true |-detect font size, default on(true)-
#newl copy /b "#path-1st.txt" + "%%a.txt" "#path-all.txt" |
#newl copy "#path-all.txt" "#path-1st.txt" |
#newl del "%%a.txt" |-cleaning-
#newl del "%%a" |-cleaning-
#newl )
#newl del "#path-all.txt" |-cleaning, it gets overwritten anyway always, so just delete it after the last file is done-
#newl "#ppthapps\txt2rtf-clvb\txt2rtf-clvb.exe" -stFileIn="#path-1st.txt" -stFileOut="#path#name-cu.rtf" |
-stEncodingIn="windows-1250" |-stEncodingIn="windows-1251" |
-stFontFamily="Times New Roman" -siFontSize=12 |-stFontFamily="Arial" -siFontSize=12 |
#newl del "#path-1st.txt" |-cleaning, final-

<comment>
Convert PDF or multipage tiff, to text using OCR (Optical character recognition).
Uses cuneiform ocr. Does not preserve formatting and tables.
Better results if images are extracted to multipage tiff using pdf-exchange, first.
If using with Cyrillic, change in the last line -stEncodingIn="windows-1250"
to -stEncodingIn="windows-1251", and language to Serbian.

Libre Office has some problems writing tables in rtf? Use Wps2014 office if editing rtf.